#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================

import os
import torch
import numpy as np


def edge_sub(edge1, edge1tmp1):
    diff = edge1tmp1.astype(np.int32) - edge1.astype(np.int32) - 10
    result = np.maximum(diff, 0)
    edge1tmp2 = result.astype(np.uint8) 
    return edge1tmp2


def gen_golden_data_simple():

    dtype = np.uint8
    width, height = 4887, 3440

    dtype = np.uint8
    input_shape = [height, width]
    output_shape = [height, width]

    img1 = np.random.uniform(0, 255, input_shape).astype(dtype)
    img2 = np.random.uniform(0, 255, input_shape).astype(dtype)
    
    golden = edge_sub(img1, img2)

    os.system("mkdir -p input")
    os.system("mkdir -p output")
    img1.astype(dtype).tofile("./input/input_img1.bin")
    img2.astype(dtype).tofile("./input/input_img2.bin")
    golden.tofile("./output/golden.bin")

if __name__ == "__main__":
    gen_golden_data_simple()

